fix: Propagate column overrides through grandchild schemas#330
Merged
Andreas Albert (AndreasAlbertQC) merged 4 commits intomainfrom Apr 17, 2026
Merged
fix: Propagate column overrides through grandchild schemas#330Andreas Albert (AndreasAlbertQC) merged 4 commits intomainfrom
Andreas Albert (AndreasAlbertQC) merged 4 commits intomainfrom
Conversation
Column overrides defined on a child schema were not shadowing the
parent's definition when traversing bases during grandchild creation,
causing `ImplementationError: Columns {...} are duplicated with
conflicting definitions.` Apply `_remove_overridden_columns` while
walking base metadata recursively so overrides propagate through
inheritance chains of any depth.
Fixes #329
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #330 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 56 56
Lines 3399 3399
=========================================
Hits 3399 3399 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
`SchemaMeta.__new__` and `_get_metadata_recursively` were duplicating the walk-bases / drop-overrides / merge-namespace sequence. Centralise it in a single helper so both paths stay in sync and future override semantics only need to change in one place. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot started reviewing on behalf of
Andreas Albert (AndreasAlbertQC)
April 17, 2026 12:32
View session
There was a problem hiding this comment.
Pull request overview
Fixes a regression in schema inheritance where column overrides defined in an intermediate subclass were not respected when creating deeper descendants (grandchild/great-grandchild schemas), causing conflicting column duplication errors.
Changes:
- Refactors schema metadata assembly to centralize base/namespace merging in a new helper and applies override-removal during recursive metadata collection.
- Ensures overridden parent columns are removed while walking inheritance chains, preventing conflicting definitions from accumulating.
- Adds regression tests covering overridden columns across grandchild and great-grandchild schemas.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
dataframely/_base_schema.py |
Applies override-removal during recursive metadata collection via a new _collect_metadata helper to prevent conflicts in deep inheritance. |
tests/schema/test_inheritance.py |
Adds regression coverage for overridden columns propagating correctly through grandchild/great-grandchild schemas. |
Widen the `namespace`/`source` parameter types from `dict[str, Any]` to `Mapping[str, Any]` so that `kls.__dict__` (a `mappingproxy`) can be passed without a `# type: ignore[arg-type]` cast. Addresses copilot review feedback on #330. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Oliver Borchert (borchero)
approved these changes
Apr 17, 2026
Member
Oliver Borchert (borchero)
left a comment
There was a problem hiding this comment.
Thanks! Approval modulo coverage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Fixes #329. Starting in 2.8.0, defining a grandchild schema that inherits from a child which overrides a parent column raises
ImplementationError: Columns {...} are duplicated with conflicting definitions.:SchemaMeta.__new__drops parent columns shadowed by the current namespace via_remove_overridden_columns, but_get_metadata_recursively— used when walking bases during grandchild creation — never applied the same logic. So bothChild's override andBase's originalamtlanded in the merged metadata and tripped the conflict check.Changes
_remove_overridden_columnsinside_get_metadata_recursivelyso column overrides propagate through inheritance chains of any depth.🤖 Generated with Claude Code